<?php
	/**
	 * The abstract TablePortfolioGen class defined here is
	 * code-generated and contains all the basic CRUD-type functionality as well as
	 * basic methods to handle relationships and index-based loading.
	 *
	 * To use, you should use the TablePortfolio subclass which
	 * extends this TablePortfolioGen class.
	 *
	 * Because subsequent re-code generations will overwrite any changes to this
	 * file, you should leave this file unaltered to prevent yourself from losing
	 * any information or code changes.  All customizations should be done by
	 * overriding existing or implementing new methods, properties and variables
	 * in the TablePortfolio class.
	 * 
	 * @package My Application
	 * @subpackage GeneratedDataObjects
	 * @property-read integer $Id the value for intId (Read-Only PK)
	 * @property integer $UserId the value for intUserId (Not Null)
	 * @property integer $BoothId the value for intBoothId (Not Null)
	 * @property integer $CategoryId the value for intCategoryId 
	 * @property integer $SubcategoryId the value for intSubcategoryId 
	 * @property integer $ColorsId the value for intColorsId 
	 * @property integer $FeelsId the value for intFeelsId 
	 * @property integer $PortfolioCategoryId the value for intPortfolioCategoryId 
	 * @property string $Title the value for strTitle (Not Null)
	 * @property string $PortfolioImage the value for strPortfolioImage 
	 * @property string $PortfolioThumnail the value for strPortfolioThumnail 
	 * @property string $Filename the value for strFilename 
	 * @property string $FilenameThumnail the value for strFilenameThumnail 
	 * @property string $Url the value for strUrl 
	 * @property string $UrlThumnail the value for strUrlThumnail 
	 * @property string $Keyword1 the value for strKeyword1 
	 * @property string $Keyword2 the value for strKeyword2 
	 * @property string $Keyword3 the value for strKeyword3 
	 * @property string $Keyword4 the value for strKeyword4 
	 * @property string $Keyword5 the value for strKeyword5 
	 * @property string $Keyword6 the value for strKeyword6 
	 * @property string $Keyword7 the value for strKeyword7 
	 * @property string $Keyword8 the value for strKeyword8 
	 * @property string $Keyword9 the value for strKeyword9 
	 * @property string $Keyword10 the value for strKeyword10 
	 * @property QDateTime $RegisterDate the value for dttRegisterDate 
	 * @property integer $Status the value for intStatus (Not Null)
	 * @property string $Active the value for strActive (Not Null)
	 * @property TableUserProject $User the value for the TableUserProject object referenced by intUserId (Not Null)
	 * @property-read boolean $__Restored whether or not this object was restored from the database (as opposed to created new)
	 */
	class TablePortfolioGen extends QBaseClass {

		///////////////////////////////////////////////////////////////////////
		// PROTECTED MEMBER VARIABLES and TEXT FIELD MAXLENGTHS (if applicable)
		///////////////////////////////////////////////////////////////////////
		
		/**
		 * Protected member variable that maps to the database PK Identity column table_portfolio.id
		 * @var integer intId
		 */
		protected $intId;
		const IdDefault = 0;


		/**
		 * Protected member variable that maps to the database column table_portfolio.user_id
		 * @var integer intUserId
		 */
		protected $intUserId;
		const UserIdDefault = 0;


		/**
		 * Protected member variable that maps to the database column table_portfolio.booth_id
		 * @var integer intBoothId
		 */
		protected $intBoothId;
		const BoothIdDefault = 0;


		/**
		 * Protected member variable that maps to the database column table_portfolio.category_id
		 * @var integer intCategoryId
		 */
		protected $intCategoryId;
		const CategoryIdDefault = 0;


		/**
		 * Protected member variable that maps to the database column table_portfolio.subcategory_id
		 * @var integer intSubcategoryId
		 */
		protected $intSubcategoryId;
		const SubcategoryIdDefault = 0;


		/**
		 * Protected member variable that maps to the database column table_portfolio.colors_id
		 * @var integer intColorsId
		 */
		protected $intColorsId;
		const ColorsIdDefault = 0;


		/**
		 * Protected member variable that maps to the database column table_portfolio.feels_id
		 * @var integer intFeelsId
		 */
		protected $intFeelsId;
		const FeelsIdDefault = 0;


		/**
		 * Protected member variable that maps to the database column table_portfolio.portfolio_category_id
		 * @var integer intPortfolioCategoryId
		 */
		protected $intPortfolioCategoryId;
		const PortfolioCategoryIdDefault = 0;


		/**
		 * Protected member variable that maps to the database column table_portfolio.title
		 * @var string strTitle
		 */
		protected $strTitle;
		const TitleMaxLength = 100;
		const TitleDefault = null;


		/**
		 * Protected member variable that maps to the database column table_portfolio.portfolio_image
		 * @var string strPortfolioImage
		 */
		protected $strPortfolioImage;
		const PortfolioImageDefault = null;


		/**
		 * Protected member variable that maps to the database column table_portfolio.portfolio_thumnail
		 * @var string strPortfolioThumnail
		 */
		protected $strPortfolioThumnail;
		const PortfolioThumnailDefault = null;


		/**
		 * Protected member variable that maps to the database column table_portfolio.filename
		 * @var string strFilename
		 */
		protected $strFilename;
		const FilenameMaxLength = 200;
		const FilenameDefault = null;


		/**
		 * Protected member variable that maps to the database column table_portfolio.filename_thumnail
		 * @var string strFilenameThumnail
		 */
		protected $strFilenameThumnail;
		const FilenameThumnailMaxLength = 200;
		const FilenameThumnailDefault = null;


		/**
		 * Protected member variable that maps to the database column table_portfolio.url
		 * @var string strUrl
		 */
		protected $strUrl;
		const UrlMaxLength = 255;
		const UrlDefault = null;


		/**
		 * Protected member variable that maps to the database column table_portfolio.url_thumnail
		 * @var string strUrlThumnail
		 */
		protected $strUrlThumnail;
		const UrlThumnailMaxLength = 255;
		const UrlThumnailDefault = null;


		/**
		 * Protected member variable that maps to the database column table_portfolio.keyword1
		 * @var string strKeyword1
		 */
		protected $strKeyword1;
		const Keyword1MaxLength = 100;
		const Keyword1Default = null;


		/**
		 * Protected member variable that maps to the database column table_portfolio.keyword2
		 * @var string strKeyword2
		 */
		protected $strKeyword2;
		const Keyword2MaxLength = 100;
		const Keyword2Default = null;


		/**
		 * Protected member variable that maps to the database column table_portfolio.keyword3
		 * @var string strKeyword3
		 */
		protected $strKeyword3;
		const Keyword3MaxLength = 100;
		const Keyword3Default = null;


		/**
		 * Protected member variable that maps to the database column table_portfolio.keyword4
		 * @var string strKeyword4
		 */
		protected $strKeyword4;
		const Keyword4MaxLength = 100;
		const Keyword4Default = null;


		/**
		 * Protected member variable that maps to the database column table_portfolio.keyword5
		 * @var string strKeyword5
		 */
		protected $strKeyword5;
		const Keyword5MaxLength = 100;
		const Keyword5Default = null;


		/**
		 * Protected member variable that maps to the database column table_portfolio.keyword6
		 * @var string strKeyword6
		 */
		protected $strKeyword6;
		const Keyword6MaxLength = 100;
		const Keyword6Default = null;


		/**
		 * Protected member variable that maps to the database column table_portfolio.keyword7
		 * @var string strKeyword7
		 */
		protected $strKeyword7;
		const Keyword7MaxLength = 100;
		const Keyword7Default = null;


		/**
		 * Protected member variable that maps to the database column table_portfolio.keyword8
		 * @var string strKeyword8
		 */
		protected $strKeyword8;
		const Keyword8MaxLength = 100;
		const Keyword8Default = null;


		/**
		 * Protected member variable that maps to the database column table_portfolio.keyword9
		 * @var string strKeyword9
		 */
		protected $strKeyword9;
		const Keyword9MaxLength = 100;
		const Keyword9Default = null;


		/**
		 * Protected member variable that maps to the database column table_portfolio.keyword10
		 * @var string strKeyword10
		 */
		protected $strKeyword10;
		const Keyword10MaxLength = 100;
		const Keyword10Default = null;


		/**
		 * Protected member variable that maps to the database column table_portfolio.register_date
		 * @var QDateTime dttRegisterDate
		 */
		protected $dttRegisterDate;
		const RegisterDateDefault = null;


		/**
		 * Protected member variable that maps to the database column table_portfolio.status
		 * @var integer intStatus
		 */
		protected $intStatus;
		const StatusDefault = 0;


		/**
		 * Protected member variable that maps to the database column table_portfolio.active
		 * @var string strActive
		 */
		protected $strActive;
		const ActiveMaxLength = 1;
		const ActiveDefault = null;


		/**
		 * Protected array of virtual attributes for this object (e.g. extra/other calculated and/or non-object bound
		 * columns from the run-time database query result for this object).  Used by InstantiateDbRow and
		 * GetVirtualAttribute.
		 * @var string[] $__strVirtualAttributeArray
		 */
		protected $__strVirtualAttributeArray = array();

		/**
		 * Protected internal member variable that specifies whether or not this object is Restored from the database.
		 * Used by Save() to determine if Save() should perform a db UPDATE or INSERT.
		 * @var bool __blnRestored;
		 */
		protected $__blnRestored;




		///////////////////////////////
		// PROTECTED MEMBER OBJECTS
		///////////////////////////////

		/**
		 * Protected member variable that contains the object pointed by the reference
		 * in the database column table_portfolio.user_id.
		 *
		 * NOTE: Always use the User property getter to correctly retrieve this TableUserProject object.
		 * (Because this class implements late binding, this variable reference MAY be null.)
		 * @var TableUserProject objUser
		 */
		protected $objUser;





		///////////////////////////////
		// CLASS-WIDE LOAD AND COUNT METHODS
		///////////////////////////////

		/**
		 * Static method to retrieve the Database object that owns this class.
		 * @return QDatabaseBase reference to the Database object that can query this class
		 */
		public static function GetDatabase() {
			return QApplication::$Database[1];
		}

		/**
		 * Load a TablePortfolio from PK Info
		 * @param integer $intId
		 * @param QQClause[] $objOptionalClauses additional optional QQClause objects for this query
		 * @return TablePortfolio
		 */
		public static function Load($intId, $objOptionalClauses = null) {
			// Use QuerySingle to Perform the Query
			return TablePortfolio::QuerySingle(
				QQ::AndCondition(
					QQ::Equal(QQN::TablePortfolio()->Id, $intId)
				),
				$objOptionalClauses
			);
		}

		/**
		 * Load all TablePortfolios
		 * @param QQClause[] $objOptionalClauses additional optional QQClause objects for this query
		 * @return TablePortfolio[]
		 */
		public static function LoadAll($objOptionalClauses = null) {
			if (func_num_args() > 1) {
				throw new QCallerException("LoadAll must be called with an array of optional clauses as a single argument");
			}
			// Call TablePortfolio::QueryArray to perform the LoadAll query
			try {
				return TablePortfolio::QueryArray(QQ::All(), $objOptionalClauses);
			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}
		}

		/**
		 * Count all TablePortfolios
		 * @return int
		 */
		public static function CountAll() {
			// Call TablePortfolio::QueryCount to perform the CountAll query
			return TablePortfolio::QueryCount(QQ::All());
		}




		///////////////////////////////
		// QCUBED QUERY-RELATED METHODS
		///////////////////////////////

		/**
		 * Internally called method to assist with calling Qcubed Query for this class
		 * on load methods.
		 * @param QQueryBuilder &$objQueryBuilder the QueryBuilder object that will be created
		 * @param QQCondition $objConditions any conditions on the query, itself
		 * @param QQClause[] $objOptionalClausees additional optional QQClause object or array of QQClause objects for this query
		 * @param mixed[] $mixParameterArray a array of name-value pairs to perform PrepareStatement with (sending in null will skip the PrepareStatement step)
		 * @param boolean $blnCountOnly only select a rowcount
		 * @return string the query statement
		 */
		protected static function BuildQueryStatement(&$objQueryBuilder, QQCondition $objConditions, $objOptionalClauses, $mixParameterArray, $blnCountOnly) {
			// Get the Database Object for this Class
			$objDatabase = TablePortfolio::GetDatabase();

			// Create/Build out the QueryBuilder object with TablePortfolio-specific SELET and FROM fields
			$objQueryBuilder = new QQueryBuilder($objDatabase, 'table_portfolio');
			TablePortfolio::GetSelectFields($objQueryBuilder);
			$objQueryBuilder->AddFromItem('table_portfolio');

			// Set "CountOnly" option (if applicable)
			if ($blnCountOnly)
				$objQueryBuilder->SetCountOnlyFlag();

			// Apply Any Conditions
			if ($objConditions)
				try {
					$objConditions->UpdateQueryBuilder($objQueryBuilder);
				} catch (QCallerException $objExc) {
					$objExc->IncrementOffset();
					throw $objExc;
				}

			// Iterate through all the Optional Clauses (if any) and perform accordingly
			if ($objOptionalClauses) {
				if ($objOptionalClauses instanceof QQClause)
					$objOptionalClauses->UpdateQueryBuilder($objQueryBuilder);
				else if (is_array($objOptionalClauses))
					foreach ($objOptionalClauses as $objClause)
						$objClause->UpdateQueryBuilder($objQueryBuilder);
				else
					throw new QCallerException('Optional Clauses must be a QQClause object or an array of QQClause objects');
			}

			// Get the SQL Statement
			$strQuery = $objQueryBuilder->GetStatement();

			// Prepare the Statement with the Query Parameters (if applicable)
			if ($mixParameterArray) {
				if (is_array($mixParameterArray)) {
					if (count($mixParameterArray))
						$strQuery = $objDatabase->PrepareStatement($strQuery, $mixParameterArray);

					// Ensure that there are no other Unresolved Named Parameters
					if (strpos($strQuery, chr(QQNamedValue::DelimiterCode) . '{') !== false)
						throw new QCallerException('Unresolved named parameters in the query');
				} else
					throw new QCallerException('Parameter Array must be an array of name-value parameter pairs');
			}

			// Return the Objects
			return $strQuery;
		}

		/**
		 * Static Qcubed Query method to query for a single TablePortfolio object.
		 * Uses BuildQueryStatment to perform most of the work.
		 * @param QQCondition $objConditions any conditions on the query, itself
		 * @param QQClause[] $objOptionalClausees additional optional QQClause objects for this query
		 * @param mixed[] $mixParameterArray a array of name-value pairs to perform PrepareStatement with
		 * @return TablePortfolio the queried object
		 */
		public static function QuerySingle(QQCondition $objConditions, $objOptionalClauses = null, $mixParameterArray = null) {
			// Get the Query Statement
			try {
				$strQuery = TablePortfolio::BuildQueryStatement($objQueryBuilder, $objConditions, $objOptionalClauses, $mixParameterArray, false);
			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}
			
			// Perform the Query, Get the First Row, and Instantiate a new TablePortfolio object
			$objDbResult = $objQueryBuilder->Database->Query($strQuery);
			
			// Do we have to expand anything?
			if ($objQueryBuilder->ExpandAsArrayNodes) {
				$objToReturn = array();
				while ($objDbRow = $objDbResult->GetNextRow()) {
					$objItem = TablePortfolio::InstantiateDbRow($objDbRow, null, $objQueryBuilder->ExpandAsArrayNodes, $objToReturn, $objQueryBuilder->ColumnAliasArray);
					if ($objItem)
						$objToReturn[] = $objItem;					
				}			
				// Since we only want the object to return, lets return the object and not the array.
				return $objToReturn[0];
			} else {
				// No expands just return the first row
				$objToReturn = null;
				while ($objDbRow = $objDbResult->GetNextRow())
					$objToReturn = TablePortfolio::InstantiateDbRow($objDbRow, null, null, null, $objQueryBuilder->ColumnAliasArray);
			}
			
			return $objToReturn;
		}

		/**
		 * Static Qcubed Query method to query for an array of TablePortfolio objects.
		 * Uses BuildQueryStatment to perform most of the work.
		 * @param QQCondition $objConditions any conditions on the query, itself
		 * @param QQClause[] $objOptionalClausees additional optional QQClause objects for this query
		 * @param mixed[] $mixParameterArray a array of name-value pairs to perform PrepareStatement with
		 * @return TablePortfolio[] the queried objects as an array
		 */
		public static function QueryArray(QQCondition $objConditions, $objOptionalClauses = null, $mixParameterArray = null) {
			// Get the Query Statement
			try {
				$strQuery = TablePortfolio::BuildQueryStatement($objQueryBuilder, $objConditions, $objOptionalClauses, $mixParameterArray, false);
			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}

			// Perform the Query and Instantiate the Array Result
			$objDbResult = $objQueryBuilder->Database->Query($strQuery);
			return TablePortfolio::InstantiateDbResult($objDbResult, $objQueryBuilder->ExpandAsArrayNodes, $objQueryBuilder->ColumnAliasArray);
		}

		/**
		 * Static Qcubed Query method to query for a count of TablePortfolio objects.
		 * Uses BuildQueryStatment to perform most of the work.
		 * @param QQCondition $objConditions any conditions on the query, itself
		 * @param QQClause[] $objOptionalClausees additional optional QQClause objects for this query
		 * @param mixed[] $mixParameterArray a array of name-value pairs to perform PrepareStatement with
		 * @return integer the count of queried objects as an integer
		 */
		public static function QueryCount(QQCondition $objConditions, $objOptionalClauses = null, $mixParameterArray = null) {
			// Get the Query Statement
			try {
				$strQuery = TablePortfolio::BuildQueryStatement($objQueryBuilder, $objConditions, $objOptionalClauses, $mixParameterArray, true);
			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}

			// Perform the Query and return the row_count
			$objDbResult = $objQueryBuilder->Database->Query($strQuery);

			// Figure out if the query is using GroupBy
			$blnGrouped = false;

			if ($objOptionalClauses) foreach ($objOptionalClauses as $objClause) {
				if ($objClause instanceof QQGroupBy) {
					$blnGrouped = true;
					break;
				}
			}

			if ($blnGrouped)
				// Groups in this query - return the count of Groups (which is the count of all rows)
				return $objDbResult->CountRows();
			else {
				// No Groups - return the sql-calculated count(*) value
				$strDbRow = $objDbResult->FetchRow();
				return QType::Cast($strDbRow[0], QType::Integer);
			}
		}

		public static function QueryArrayCached(QQCondition $objConditions, $objOptionalClauses = null, $mixParameterArray = null, $blnForceUpdate = false) {
			// Get the Database Object for this Class
			$objDatabase = TablePortfolio::GetDatabase();

			$strQuery = TablePortfolio::BuildQueryStatement($objQueryBuilder, $objConditions, $objOptionalClauses, $mixParameterArray, false);
			
			$objCache = new QCache('qquery/tableportfolio', $strQuery);
			$cacheData = $objCache->GetData();
			
			if (!$cacheData || $blnForceUpdate) {
				$objDbResult = $objQueryBuilder->Database->Query($strQuery);
				$arrResult = TablePortfolio::InstantiateDbResult($objDbResult, $objQueryBuilder->ExpandAsArrayNodes, $objQueryBuilder->ColumnAliasArray);
				$objCache->SaveData(serialize($arrResult));
			} else {
				$arrResult = unserialize($cacheData);
			}
			
			return $arrResult;
		}

		/**
		 * Updates a QQueryBuilder with the SELECT fields for this TablePortfolio
		 * @param QQueryBuilder $objBuilder the Query Builder object to update
		 * @param string $strPrefix optional prefix to add to the SELECT fields
		 */
		public static function GetSelectFields(QQueryBuilder $objBuilder, $strPrefix = null) {
			if ($strPrefix) {
				$strTableName = $strPrefix;
				$strAliasPrefix = $strPrefix . '__';
			} else {
				$strTableName = 'table_portfolio';
				$strAliasPrefix = '';
			}

			$objBuilder->AddSelectItem($strTableName, 'id', $strAliasPrefix . 'id');
			$objBuilder->AddSelectItem($strTableName, 'user_id', $strAliasPrefix . 'user_id');
			$objBuilder->AddSelectItem($strTableName, 'booth_id', $strAliasPrefix . 'booth_id');
			$objBuilder->AddSelectItem($strTableName, 'category_id', $strAliasPrefix . 'category_id');
			$objBuilder->AddSelectItem($strTableName, 'subcategory_id', $strAliasPrefix . 'subcategory_id');
			$objBuilder->AddSelectItem($strTableName, 'colors_id', $strAliasPrefix . 'colors_id');
			$objBuilder->AddSelectItem($strTableName, 'feels_id', $strAliasPrefix . 'feels_id');
			$objBuilder->AddSelectItem($strTableName, 'portfolio_category_id', $strAliasPrefix . 'portfolio_category_id');
			$objBuilder->AddSelectItem($strTableName, 'title', $strAliasPrefix . 'title');
			$objBuilder->AddSelectItem($strTableName, 'portfolio_image', $strAliasPrefix . 'portfolio_image');
			$objBuilder->AddSelectItem($strTableName, 'portfolio_thumnail', $strAliasPrefix . 'portfolio_thumnail');
			$objBuilder->AddSelectItem($strTableName, 'filename', $strAliasPrefix . 'filename');
			$objBuilder->AddSelectItem($strTableName, 'filename_thumnail', $strAliasPrefix . 'filename_thumnail');
			$objBuilder->AddSelectItem($strTableName, 'url', $strAliasPrefix . 'url');
			$objBuilder->AddSelectItem($strTableName, 'url_thumnail', $strAliasPrefix . 'url_thumnail');
			$objBuilder->AddSelectItem($strTableName, 'keyword1', $strAliasPrefix . 'keyword1');
			$objBuilder->AddSelectItem($strTableName, 'keyword2', $strAliasPrefix . 'keyword2');
			$objBuilder->AddSelectItem($strTableName, 'keyword3', $strAliasPrefix . 'keyword3');
			$objBuilder->AddSelectItem($strTableName, 'keyword4', $strAliasPrefix . 'keyword4');
			$objBuilder->AddSelectItem($strTableName, 'keyword5', $strAliasPrefix . 'keyword5');
			$objBuilder->AddSelectItem($strTableName, 'keyword6', $strAliasPrefix . 'keyword6');
			$objBuilder->AddSelectItem($strTableName, 'keyword7', $strAliasPrefix . 'keyword7');
			$objBuilder->AddSelectItem($strTableName, 'keyword8', $strAliasPrefix . 'keyword8');
			$objBuilder->AddSelectItem($strTableName, 'keyword9', $strAliasPrefix . 'keyword9');
			$objBuilder->AddSelectItem($strTableName, 'keyword10', $strAliasPrefix . 'keyword10');
			$objBuilder->AddSelectItem($strTableName, 'register_date', $strAliasPrefix . 'register_date');
			$objBuilder->AddSelectItem($strTableName, 'status', $strAliasPrefix . 'status');
			$objBuilder->AddSelectItem($strTableName, 'active', $strAliasPrefix . 'active');
		}



		///////////////////////////////
		// INSTANTIATION-RELATED METHODS
		///////////////////////////////

		/**
		 * Instantiate a TablePortfolio from a Database Row.
		 * Takes in an optional strAliasPrefix, used in case another Object::InstantiateDbRow
		 * is calling this TablePortfolio::InstantiateDbRow in order to perform
		 * early binding on referenced objects.
		 * @param DatabaseRowBase $objDbRow
		 * @param string $strAliasPrefix
		 * @param string $strExpandAsArrayNodes
		 * @param QBaseClass $arrPreviousItem
		 * @param string[] $strColumnAliasArray
		 * @return TablePortfolio
		*/
		public static function InstantiateDbRow($objDbRow, $strAliasPrefix = null, $strExpandAsArrayNodes = null, $arrPreviousItems = null, $strColumnAliasArray = array()) {
			// If blank row, return null
			if (!$objDbRow) {
				return null;
			}

			// Create a new instance of the TablePortfolio object
			$objToReturn = new TablePortfolio();
			$objToReturn->__blnRestored = true;

			$strAliasName = array_key_exists($strAliasPrefix . 'id', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'id'] : $strAliasPrefix . 'id';
			$objToReturn->intId = $objDbRow->GetColumn($strAliasName, 'Integer');
			$strAliasName = array_key_exists($strAliasPrefix . 'user_id', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'user_id'] : $strAliasPrefix . 'user_id';
			$objToReturn->intUserId = $objDbRow->GetColumn($strAliasName, 'Integer');
			$strAliasName = array_key_exists($strAliasPrefix . 'booth_id', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'booth_id'] : $strAliasPrefix . 'booth_id';
			$objToReturn->intBoothId = $objDbRow->GetColumn($strAliasName, 'Integer');
			$strAliasName = array_key_exists($strAliasPrefix . 'category_id', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'category_id'] : $strAliasPrefix . 'category_id';
			$objToReturn->intCategoryId = $objDbRow->GetColumn($strAliasName, 'Integer');
			$strAliasName = array_key_exists($strAliasPrefix . 'subcategory_id', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'subcategory_id'] : $strAliasPrefix . 'subcategory_id';
			$objToReturn->intSubcategoryId = $objDbRow->GetColumn($strAliasName, 'Integer');
			$strAliasName = array_key_exists($strAliasPrefix . 'colors_id', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'colors_id'] : $strAliasPrefix . 'colors_id';
			$objToReturn->intColorsId = $objDbRow->GetColumn($strAliasName, 'Integer');
			$strAliasName = array_key_exists($strAliasPrefix . 'feels_id', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'feels_id'] : $strAliasPrefix . 'feels_id';
			$objToReturn->intFeelsId = $objDbRow->GetColumn($strAliasName, 'Integer');
			$strAliasName = array_key_exists($strAliasPrefix . 'portfolio_category_id', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'portfolio_category_id'] : $strAliasPrefix . 'portfolio_category_id';
			$objToReturn->intPortfolioCategoryId = $objDbRow->GetColumn($strAliasName, 'Integer');
			$strAliasName = array_key_exists($strAliasPrefix . 'title', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'title'] : $strAliasPrefix . 'title';
			$objToReturn->strTitle = $objDbRow->GetColumn($strAliasName, 'VarChar');
			$strAliasName = array_key_exists($strAliasPrefix . 'portfolio_image', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'portfolio_image'] : $strAliasPrefix . 'portfolio_image';
			$objToReturn->strPortfolioImage = $objDbRow->GetColumn($strAliasName, 'Blob');
			$strAliasName = array_key_exists($strAliasPrefix . 'portfolio_thumnail', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'portfolio_thumnail'] : $strAliasPrefix . 'portfolio_thumnail';
			$objToReturn->strPortfolioThumnail = $objDbRow->GetColumn($strAliasName, 'Blob');
			$strAliasName = array_key_exists($strAliasPrefix . 'filename', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'filename'] : $strAliasPrefix . 'filename';
			$objToReturn->strFilename = $objDbRow->GetColumn($strAliasName, 'VarChar');
			$strAliasName = array_key_exists($strAliasPrefix . 'filename_thumnail', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'filename_thumnail'] : $strAliasPrefix . 'filename_thumnail';
			$objToReturn->strFilenameThumnail = $objDbRow->GetColumn($strAliasName, 'VarChar');
			$strAliasName = array_key_exists($strAliasPrefix . 'url', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'url'] : $strAliasPrefix . 'url';
			$objToReturn->strUrl = $objDbRow->GetColumn($strAliasName, 'VarChar');
			$strAliasName = array_key_exists($strAliasPrefix . 'url_thumnail', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'url_thumnail'] : $strAliasPrefix . 'url_thumnail';
			$objToReturn->strUrlThumnail = $objDbRow->GetColumn($strAliasName, 'VarChar');
			$strAliasName = array_key_exists($strAliasPrefix . 'keyword1', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'keyword1'] : $strAliasPrefix . 'keyword1';
			$objToReturn->strKeyword1 = $objDbRow->GetColumn($strAliasName, 'VarChar');
			$strAliasName = array_key_exists($strAliasPrefix . 'keyword2', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'keyword2'] : $strAliasPrefix . 'keyword2';
			$objToReturn->strKeyword2 = $objDbRow->GetColumn($strAliasName, 'VarChar');
			$strAliasName = array_key_exists($strAliasPrefix . 'keyword3', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'keyword3'] : $strAliasPrefix . 'keyword3';
			$objToReturn->strKeyword3 = $objDbRow->GetColumn($strAliasName, 'VarChar');
			$strAliasName = array_key_exists($strAliasPrefix . 'keyword4', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'keyword4'] : $strAliasPrefix . 'keyword4';
			$objToReturn->strKeyword4 = $objDbRow->GetColumn($strAliasName, 'VarChar');
			$strAliasName = array_key_exists($strAliasPrefix . 'keyword5', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'keyword5'] : $strAliasPrefix . 'keyword5';
			$objToReturn->strKeyword5 = $objDbRow->GetColumn($strAliasName, 'VarChar');
			$strAliasName = array_key_exists($strAliasPrefix . 'keyword6', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'keyword6'] : $strAliasPrefix . 'keyword6';
			$objToReturn->strKeyword6 = $objDbRow->GetColumn($strAliasName, 'VarChar');
			$strAliasName = array_key_exists($strAliasPrefix . 'keyword7', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'keyword7'] : $strAliasPrefix . 'keyword7';
			$objToReturn->strKeyword7 = $objDbRow->GetColumn($strAliasName, 'VarChar');
			$strAliasName = array_key_exists($strAliasPrefix . 'keyword8', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'keyword8'] : $strAliasPrefix . 'keyword8';
			$objToReturn->strKeyword8 = $objDbRow->GetColumn($strAliasName, 'VarChar');
			$strAliasName = array_key_exists($strAliasPrefix . 'keyword9', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'keyword9'] : $strAliasPrefix . 'keyword9';
			$objToReturn->strKeyword9 = $objDbRow->GetColumn($strAliasName, 'VarChar');
			$strAliasName = array_key_exists($strAliasPrefix . 'keyword10', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'keyword10'] : $strAliasPrefix . 'keyword10';
			$objToReturn->strKeyword10 = $objDbRow->GetColumn($strAliasName, 'VarChar');
			$strAliasName = array_key_exists($strAliasPrefix . 'register_date', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'register_date'] : $strAliasPrefix . 'register_date';
			$objToReturn->dttRegisterDate = $objDbRow->GetColumn($strAliasName, 'DateTime');
			$strAliasName = array_key_exists($strAliasPrefix . 'status', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'status'] : $strAliasPrefix . 'status';
			$objToReturn->intStatus = $objDbRow->GetColumn($strAliasName, 'Integer');
			$strAliasName = array_key_exists($strAliasPrefix . 'active', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'active'] : $strAliasPrefix . 'active';
			$objToReturn->strActive = $objDbRow->GetColumn($strAliasName, 'VarChar');

			if (isset($arrPreviousItems) && is_array($arrPreviousItems)) {
				foreach ($arrPreviousItems as $objPreviousItem) {
					if ($objToReturn->Id != $objPreviousItem->Id) {
						continue;
					}

					// complete match - all primary key columns are the same
					return null;
				}
			}

			// Instantiate Virtual Attributes
			foreach ($objDbRow->GetColumnNameArray() as $strColumnName => $mixValue) {
				$strVirtualPrefix = $strAliasPrefix . '__';
				$strVirtualPrefixLength = strlen($strVirtualPrefix);
				if (substr($strColumnName, 0, $strVirtualPrefixLength) == $strVirtualPrefix)
					$objToReturn->__strVirtualAttributeArray[substr($strColumnName, $strVirtualPrefixLength)] = $mixValue;
			}

			// Prepare to Check for Early/Virtual Binding
			if (!$strAliasPrefix)
				$strAliasPrefix = 'table_portfolio__';

			// Check for User Early Binding
			$strAlias = $strAliasPrefix . 'user_id__id';
			$strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias;
			if (!is_null($objDbRow->GetColumn($strAliasName)))
				$objToReturn->objUser = TableUserProject::InstantiateDbRow($objDbRow, $strAliasPrefix . 'user_id__', $strExpandAsArrayNodes, null, $strColumnAliasArray);




			return $objToReturn;
		}

		/**
		 * Instantiate an array of TablePortfolios from a Database Result
		 * @param DatabaseResultBase $objDbResult
		 * @param string $strExpandAsArrayNodes
		 * @param string[] $strColumnAliasArray
		 * @return TablePortfolio[]
		 */
		public static function InstantiateDbResult(QDatabaseResultBase $objDbResult, $strExpandAsArrayNodes = null, $strColumnAliasArray = null) {
			$objToReturn = array();
			
			if (!$strColumnAliasArray)
				$strColumnAliasArray = array();

			// If blank resultset, then return empty array
			if (!$objDbResult)
				return $objToReturn;

			// Load up the return array with each row
			if ($strExpandAsArrayNodes) {
				$objToReturn = array();
				while ($objDbRow = $objDbResult->GetNextRow()) {
					$objItem = TablePortfolio::InstantiateDbRow($objDbRow, null, $strExpandAsArrayNodes, $objToReturn, $strColumnAliasArray);
					if ($objItem) {
						$objToReturn[] = $objItem;
					}
				}
			} else {
				while ($objDbRow = $objDbResult->GetNextRow())
					$objToReturn[] = TablePortfolio::InstantiateDbRow($objDbRow, null, null, null, $strColumnAliasArray);
			}

			return $objToReturn;
		}



		///////////////////////////////////////////////////
		// INDEX-BASED LOAD METHODS (Single Load and Array)
		///////////////////////////////////////////////////
			
		/**
		 * Load a single TablePortfolio object,
		 * by Id Index(es)
		 * @param integer $intId
		 * @param QQClause[] $objOptionalClauses additional optional QQClause objects for this query
		 * @return TablePortfolio
		*/
		public static function LoadById($intId, $objOptionalClauses = null) {
			return TablePortfolio::QuerySingle(
				QQ::AndCondition(
					QQ::Equal(QQN::TablePortfolio()->Id, $intId)
				),
				$objOptionalClauses
			);
		}
			
		/**
		 * Load an array of TablePortfolio objects,
		 * by UserId Index(es)
		 * @param integer $intUserId
		 * @param QQClause[] $objOptionalClauses additional optional QQClause objects for this query
		 * @return TablePortfolio[]
		*/
		public static function LoadArrayByUserId($intUserId, $objOptionalClauses = null) {
			// Call TablePortfolio::QueryArray to perform the LoadArrayByUserId query
			try {
				return TablePortfolio::QueryArray(
					QQ::Equal(QQN::TablePortfolio()->UserId, $intUserId),
					$objOptionalClauses);
			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}
		}

		/**
		 * Count TablePortfolios
		 * by UserId Index(es)
		 * @param integer $intUserId
		 * @return int
		*/
		public static function CountByUserId($intUserId) {
			// Call TablePortfolio::QueryCount to perform the CountByUserId query
			return TablePortfolio::QueryCount(
				QQ::Equal(QQN::TablePortfolio()->UserId, $intUserId)
			);
		}
			
		/**
		 * Load an array of TablePortfolio objects,
		 * by BoothId Index(es)
		 * @param integer $intBoothId
		 * @param QQClause[] $objOptionalClauses additional optional QQClause objects for this query
		 * @return TablePortfolio[]
		*/
		public static function LoadArrayByBoothId($intBoothId, $objOptionalClauses = null) {
			// Call TablePortfolio::QueryArray to perform the LoadArrayByBoothId query
			try {
				return TablePortfolio::QueryArray(
					QQ::Equal(QQN::TablePortfolio()->BoothId, $intBoothId),
					$objOptionalClauses);
			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}
		}

		/**
		 * Count TablePortfolios
		 * by BoothId Index(es)
		 * @param integer $intBoothId
		 * @return int
		*/
		public static function CountByBoothId($intBoothId) {
			// Call TablePortfolio::QueryCount to perform the CountByBoothId query
			return TablePortfolio::QueryCount(
				QQ::Equal(QQN::TablePortfolio()->BoothId, $intBoothId)
			);
		}
			
		/**
		 * Load an array of TablePortfolio objects,
		 * by CategoryId Index(es)
		 * @param integer $intCategoryId
		 * @param QQClause[] $objOptionalClauses additional optional QQClause objects for this query
		 * @return TablePortfolio[]
		*/
		public static function LoadArrayByCategoryId($intCategoryId, $objOptionalClauses = null) {
			// Call TablePortfolio::QueryArray to perform the LoadArrayByCategoryId query
			try {
				return TablePortfolio::QueryArray(
					QQ::Equal(QQN::TablePortfolio()->CategoryId, $intCategoryId),
					$objOptionalClauses);
			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}
		}

		/**
		 * Count TablePortfolios
		 * by CategoryId Index(es)
		 * @param integer $intCategoryId
		 * @return int
		*/
		public static function CountByCategoryId($intCategoryId) {
			// Call TablePortfolio::QueryCount to perform the CountByCategoryId query
			return TablePortfolio::QueryCount(
				QQ::Equal(QQN::TablePortfolio()->CategoryId, $intCategoryId)
			);
		}
			
		/**
		 * Load an array of TablePortfolio objects,
		 * by SubcategoryId Index(es)
		 * @param integer $intSubcategoryId
		 * @param QQClause[] $objOptionalClauses additional optional QQClause objects for this query
		 * @return TablePortfolio[]
		*/
		public static function LoadArrayBySubcategoryId($intSubcategoryId, $objOptionalClauses = null) {
			// Call TablePortfolio::QueryArray to perform the LoadArrayBySubcategoryId query
			try {
				return TablePortfolio::QueryArray(
					QQ::Equal(QQN::TablePortfolio()->SubcategoryId, $intSubcategoryId),
					$objOptionalClauses);
			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}
		}

		/**
		 * Count TablePortfolios
		 * by SubcategoryId Index(es)
		 * @param integer $intSubcategoryId
		 * @return int
		*/
		public static function CountBySubcategoryId($intSubcategoryId) {
			// Call TablePortfolio::QueryCount to perform the CountBySubcategoryId query
			return TablePortfolio::QueryCount(
				QQ::Equal(QQN::TablePortfolio()->SubcategoryId, $intSubcategoryId)
			);
		}
			
		/**
		 * Load an array of TablePortfolio objects,
		 * by PortfolioCategoryId Index(es)
		 * @param integer $intPortfolioCategoryId
		 * @param QQClause[] $objOptionalClauses additional optional QQClause objects for this query
		 * @return TablePortfolio[]
		*/
		public static function LoadArrayByPortfolioCategoryId($intPortfolioCategoryId, $objOptionalClauses = null) {
			// Call TablePortfolio::QueryArray to perform the LoadArrayByPortfolioCategoryId query
			try {
				return TablePortfolio::QueryArray(
					QQ::Equal(QQN::TablePortfolio()->PortfolioCategoryId, $intPortfolioCategoryId),
					$objOptionalClauses);
			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}
		}

		/**
		 * Count TablePortfolios
		 * by PortfolioCategoryId Index(es)
		 * @param integer $intPortfolioCategoryId
		 * @return int
		*/
		public static function CountByPortfolioCategoryId($intPortfolioCategoryId) {
			// Call TablePortfolio::QueryCount to perform the CountByPortfolioCategoryId query
			return TablePortfolio::QueryCount(
				QQ::Equal(QQN::TablePortfolio()->PortfolioCategoryId, $intPortfolioCategoryId)
			);
		}
			
		/**
		 * Load an array of TablePortfolio objects,
		 * by Keyword1 Index(es)
		 * @param string $strKeyword1
		 * @param QQClause[] $objOptionalClauses additional optional QQClause objects for this query
		 * @return TablePortfolio[]
		*/
		public static function LoadArrayByKeyword1($strKeyword1, $objOptionalClauses = null) {
			// Call TablePortfolio::QueryArray to perform the LoadArrayByKeyword1 query
			try {
				return TablePortfolio::QueryArray(
					QQ::Equal(QQN::TablePortfolio()->Keyword1, $strKeyword1),
					$objOptionalClauses);
			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}
		}

		/**
		 * Count TablePortfolios
		 * by Keyword1 Index(es)
		 * @param string $strKeyword1
		 * @return int
		*/
		public static function CountByKeyword1($strKeyword1) {
			// Call TablePortfolio::QueryCount to perform the CountByKeyword1 query
			return TablePortfolio::QueryCount(
				QQ::Equal(QQN::TablePortfolio()->Keyword1, $strKeyword1)
			);
		}
			
		/**
		 * Load an array of TablePortfolio objects,
		 * by Keyword2 Index(es)
		 * @param string $strKeyword2
		 * @param QQClause[] $objOptionalClauses additional optional QQClause objects for this query
		 * @return TablePortfolio[]
		*/
		public static function LoadArrayByKeyword2($strKeyword2, $objOptionalClauses = null) {
			// Call TablePortfolio::QueryArray to perform the LoadArrayByKeyword2 query
			try {
				return TablePortfolio::QueryArray(
					QQ::Equal(QQN::TablePortfolio()->Keyword2, $strKeyword2),
					$objOptionalClauses);
			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}
		}

		/**
		 * Count TablePortfolios
		 * by Keyword2 Index(es)
		 * @param string $strKeyword2
		 * @return int
		*/
		public static function CountByKeyword2($strKeyword2) {
			// Call TablePortfolio::QueryCount to perform the CountByKeyword2 query
			return TablePortfolio::QueryCount(
				QQ::Equal(QQN::TablePortfolio()->Keyword2, $strKeyword2)
			);
		}
			
		/**
		 * Load an array of TablePortfolio objects,
		 * by Keyword3 Index(es)
		 * @param string $strKeyword3
		 * @param QQClause[] $objOptionalClauses additional optional QQClause objects for this query
		 * @return TablePortfolio[]
		*/
		public static function LoadArrayByKeyword3($strKeyword3, $objOptionalClauses = null) {
			// Call TablePortfolio::QueryArray to perform the LoadArrayByKeyword3 query
			try {
				return TablePortfolio::QueryArray(
					QQ::Equal(QQN::TablePortfolio()->Keyword3, $strKeyword3),
					$objOptionalClauses);
			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}
		}

		/**
		 * Count TablePortfolios
		 * by Keyword3 Index(es)
		 * @param string $strKeyword3
		 * @return int
		*/
		public static function CountByKeyword3($strKeyword3) {
			// Call TablePortfolio::QueryCount to perform the CountByKeyword3 query
			return TablePortfolio::QueryCount(
				QQ::Equal(QQN::TablePortfolio()->Keyword3, $strKeyword3)
			);
		}
			
		/**
		 * Load an array of TablePortfolio objects,
		 * by Keyword4 Index(es)
		 * @param string $strKeyword4
		 * @param QQClause[] $objOptionalClauses additional optional QQClause objects for this query
		 * @return TablePortfolio[]
		*/
		public static function LoadArrayByKeyword4($strKeyword4, $objOptionalClauses = null) {
			// Call TablePortfolio::QueryArray to perform the LoadArrayByKeyword4 query
			try {
				return TablePortfolio::QueryArray(
					QQ::Equal(QQN::TablePortfolio()->Keyword4, $strKeyword4),
					$objOptionalClauses);
			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}
		}

		/**
		 * Count TablePortfolios
		 * by Keyword4 Index(es)
		 * @param string $strKeyword4
		 * @return int
		*/
		public static function CountByKeyword4($strKeyword4) {
			// Call TablePortfolio::QueryCount to perform the CountByKeyword4 query
			return TablePortfolio::QueryCount(
				QQ::Equal(QQN::TablePortfolio()->Keyword4, $strKeyword4)
			);
		}
			
		/**
		 * Load an array of TablePortfolio objects,
		 * by Keyword5 Index(es)
		 * @param string $strKeyword5
		 * @param QQClause[] $objOptionalClauses additional optional QQClause objects for this query
		 * @return TablePortfolio[]
		*/
		public static function LoadArrayByKeyword5($strKeyword5, $objOptionalClauses = null) {
			// Call TablePortfolio::QueryArray to perform the LoadArrayByKeyword5 query
			try {
				return TablePortfolio::QueryArray(
					QQ::Equal(QQN::TablePortfolio()->Keyword5, $strKeyword5),
					$objOptionalClauses);
			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}
		}

		/**
		 * Count TablePortfolios
		 * by Keyword5 Index(es)
		 * @param string $strKeyword5
		 * @return int
		*/
		public static function CountByKeyword5($strKeyword5) {
			// Call TablePortfolio::QueryCount to perform the CountByKeyword5 query
			return TablePortfolio::QueryCount(
				QQ::Equal(QQN::TablePortfolio()->Keyword5, $strKeyword5)
			);
		}
			
		/**
		 * Load an array of TablePortfolio objects,
		 * by Keyword6 Index(es)
		 * @param string $strKeyword6
		 * @param QQClause[] $objOptionalClauses additional optional QQClause objects for this query
		 * @return TablePortfolio[]
		*/
		public static function LoadArrayByKeyword6($strKeyword6, $objOptionalClauses = null) {
			// Call TablePortfolio::QueryArray to perform the LoadArrayByKeyword6 query
			try {
				return TablePortfolio::QueryArray(
					QQ::Equal(QQN::TablePortfolio()->Keyword6, $strKeyword6),
					$objOptionalClauses);
			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}
		}

		/**
		 * Count TablePortfolios
		 * by Keyword6 Index(es)
		 * @param string $strKeyword6
		 * @return int
		*/
		public static function CountByKeyword6($strKeyword6) {
			// Call TablePortfolio::QueryCount to perform the CountByKeyword6 query
			return TablePortfolio::QueryCount(
				QQ::Equal(QQN::TablePortfolio()->Keyword6, $strKeyword6)
			);
		}
			
		/**
		 * Load an array of TablePortfolio objects,
		 * by Keyword7 Index(es)
		 * @param string $strKeyword7
		 * @param QQClause[] $objOptionalClauses additional optional QQClause objects for this query
		 * @return TablePortfolio[]
		*/
		public static function LoadArrayByKeyword7($strKeyword7, $objOptionalClauses = null) {
			// Call TablePortfolio::QueryArray to perform the LoadArrayByKeyword7 query
			try {
				return TablePortfolio::QueryArray(
					QQ::Equal(QQN::TablePortfolio()->Keyword7, $strKeyword7),
					$objOptionalClauses);
			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}
		}

		/**
		 * Count TablePortfolios
		 * by Keyword7 Index(es)
		 * @param string $strKeyword7
		 * @return int
		*/
		public static function CountByKeyword7($strKeyword7) {
			// Call TablePortfolio::QueryCount to perform the CountByKeyword7 query
			return TablePortfolio::QueryCount(
				QQ::Equal(QQN::TablePortfolio()->Keyword7, $strKeyword7)
			);
		}
			
		/**
		 * Load an array of TablePortfolio objects,
		 * by Keyword8 Index(es)
		 * @param string $strKeyword8
		 * @param QQClause[] $objOptionalClauses additional optional QQClause objects for this query
		 * @return TablePortfolio[]
		*/
		public static function LoadArrayByKeyword8($strKeyword8, $objOptionalClauses = null) {
			// Call TablePortfolio::QueryArray to perform the LoadArrayByKeyword8 query
			try {
				return TablePortfolio::QueryArray(
					QQ::Equal(QQN::TablePortfolio()->Keyword8, $strKeyword8),
					$objOptionalClauses);
			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}
		}

		/**
		 * Count TablePortfolios
		 * by Keyword8 Index(es)
		 * @param string $strKeyword8
		 * @return int
		*/
		public static function CountByKeyword8($strKeyword8) {
			// Call TablePortfolio::QueryCount to perform the CountByKeyword8 query
			return TablePortfolio::QueryCount(
				QQ::Equal(QQN::TablePortfolio()->Keyword8, $strKeyword8)
			);
		}
			
		/**
		 * Load an array of TablePortfolio objects,
		 * by Keyword9 Index(es)
		 * @param string $strKeyword9
		 * @param QQClause[] $objOptionalClauses additional optional QQClause objects for this query
		 * @return TablePortfolio[]
		*/
		public static function LoadArrayByKeyword9($strKeyword9, $objOptionalClauses = null) {
			// Call TablePortfolio::QueryArray to perform the LoadArrayByKeyword9 query
			try {
				return TablePortfolio::QueryArray(
					QQ::Equal(QQN::TablePortfolio()->Keyword9, $strKeyword9),
					$objOptionalClauses);
			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}
		}

		/**
		 * Count TablePortfolios
		 * by Keyword9 Index(es)
		 * @param string $strKeyword9
		 * @return int
		*/
		public static function CountByKeyword9($strKeyword9) {
			// Call TablePortfolio::QueryCount to perform the CountByKeyword9 query
			return TablePortfolio::QueryCount(
				QQ::Equal(QQN::TablePortfolio()->Keyword9, $strKeyword9)
			);
		}
			
		/**
		 * Load an array of TablePortfolio objects,
		 * by Keyword10 Index(es)
		 * @param string $strKeyword10
		 * @param QQClause[] $objOptionalClauses additional optional QQClause objects for this query
		 * @return TablePortfolio[]
		*/
		public static function LoadArrayByKeyword10($strKeyword10, $objOptionalClauses = null) {
			// Call TablePortfolio::QueryArray to perform the LoadArrayByKeyword10 query
			try {
				return TablePortfolio::QueryArray(
					QQ::Equal(QQN::TablePortfolio()->Keyword10, $strKeyword10),
					$objOptionalClauses);
			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}
		}

		/**
		 * Count TablePortfolios
		 * by Keyword10 Index(es)
		 * @param string $strKeyword10
		 * @return int
		*/
		public static function CountByKeyword10($strKeyword10) {
			// Call TablePortfolio::QueryCount to perform the CountByKeyword10 query
			return TablePortfolio::QueryCount(
				QQ::Equal(QQN::TablePortfolio()->Keyword10, $strKeyword10)
			);
		}
			
		/**
		 * Load an array of TablePortfolio objects,
		 * by RegisterDate Index(es)
		 * @param QDateTime $dttRegisterDate
		 * @param QQClause[] $objOptionalClauses additional optional QQClause objects for this query
		 * @return TablePortfolio[]
		*/
		public static function LoadArrayByRegisterDate($dttRegisterDate, $objOptionalClauses = null) {
			// Call TablePortfolio::QueryArray to perform the LoadArrayByRegisterDate query
			try {
				return TablePortfolio::QueryArray(
					QQ::Equal(QQN::TablePortfolio()->RegisterDate, $dttRegisterDate),
					$objOptionalClauses);
			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}
		}

		/**
		 * Count TablePortfolios
		 * by RegisterDate Index(es)
		 * @param QDateTime $dttRegisterDate
		 * @return int
		*/
		public static function CountByRegisterDate($dttRegisterDate) {
			// Call TablePortfolio::QueryCount to perform the CountByRegisterDate query
			return TablePortfolio::QueryCount(
				QQ::Equal(QQN::TablePortfolio()->RegisterDate, $dttRegisterDate)
			);
		}
			
		/**
		 * Load an array of TablePortfolio objects,
		 * by Status Index(es)
		 * @param integer $intStatus
		 * @param QQClause[] $objOptionalClauses additional optional QQClause objects for this query
		 * @return TablePortfolio[]
		*/
		public static function LoadArrayByStatus($intStatus, $objOptionalClauses = null) {
			// Call TablePortfolio::QueryArray to perform the LoadArrayByStatus query
			try {
				return TablePortfolio::QueryArray(
					QQ::Equal(QQN::TablePortfolio()->Status, $intStatus),
					$objOptionalClauses);
			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}
		}

		/**
		 * Count TablePortfolios
		 * by Status Index(es)
		 * @param integer $intStatus
		 * @return int
		*/
		public static function CountByStatus($intStatus) {
			// Call TablePortfolio::QueryCount to perform the CountByStatus query
			return TablePortfolio::QueryCount(
				QQ::Equal(QQN::TablePortfolio()->Status, $intStatus)
			);
		}
			
		/**
		 * Load an array of TablePortfolio objects,
		 * by Active Index(es)
		 * @param string $strActive
		 * @param QQClause[] $objOptionalClauses additional optional QQClause objects for this query
		 * @return TablePortfolio[]
		*/
		public static function LoadArrayByActive($strActive, $objOptionalClauses = null) {
			// Call TablePortfolio::QueryArray to perform the LoadArrayByActive query
			try {
				return TablePortfolio::QueryArray(
					QQ::Equal(QQN::TablePortfolio()->Active, $strActive),
					$objOptionalClauses);
			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}
		}

		/**
		 * Count TablePortfolios
		 * by Active Index(es)
		 * @param string $strActive
		 * @return int
		*/
		public static function CountByActive($strActive) {
			// Call TablePortfolio::QueryCount to perform the CountByActive query
			return TablePortfolio::QueryCount(
				QQ::Equal(QQN::TablePortfolio()->Active, $strActive)
			);
		}



		////////////////////////////////////////////////////
		// INDEX-BASED LOAD METHODS (Array via Many to Many)
		////////////////////////////////////////////////////




		//////////////////////////
		// SAVE, DELETE AND RELOAD
		//////////////////////////

		/**
		 * Save this TablePortfolio
		 * @param bool $blnForceInsert
		 * @param bool $blnForceUpdate
		 * @return int
		 */
		public function Save($blnForceInsert = false, $blnForceUpdate = false) {
			// Get the Database Object for this Class
			$objDatabase = TablePortfolio::GetDatabase();

			$mixToReturn = null;

			try {
				if ((!$this->__blnRestored) || ($blnForceInsert)) {
					// Perform an INSERT query
					$objDatabase->NonQuery('
						INSERT INTO `table_portfolio` (
							`user_id`,
							`booth_id`,
							`category_id`,
							`subcategory_id`,
							`colors_id`,
							`feels_id`,
							`portfolio_category_id`,
							`title`,
							`portfolio_image`,
							`portfolio_thumnail`,
							`filename`,
							`filename_thumnail`,
							`url`,
							`url_thumnail`,
							`keyword1`,
							`keyword2`,
							`keyword3`,
							`keyword4`,
							`keyword5`,
							`keyword6`,
							`keyword7`,
							`keyword8`,
							`keyword9`,
							`keyword10`,
							`register_date`,
							`status`,
							`active`
						) VALUES (
							' . $objDatabase->SqlVariable($this->intUserId) . ',
							' . $objDatabase->SqlVariable($this->intBoothId) . ',
							' . $objDatabase->SqlVariable($this->intCategoryId) . ',
							' . $objDatabase->SqlVariable($this->intSubcategoryId) . ',
							' . $objDatabase->SqlVariable($this->intColorsId) . ',
							' . $objDatabase->SqlVariable($this->intFeelsId) . ',
							' . $objDatabase->SqlVariable($this->intPortfolioCategoryId) . ',
							' . $objDatabase->SqlVariable($this->strTitle) . ',
							' . $objDatabase->SqlVariable($this->strPortfolioImage) . ',
							' . $objDatabase->SqlVariable($this->strPortfolioThumnail) . ',
							' . $objDatabase->SqlVariable($this->strFilename) . ',
							' . $objDatabase->SqlVariable($this->strFilenameThumnail) . ',
							' . $objDatabase->SqlVariable($this->strUrl) . ',
							' . $objDatabase->SqlVariable($this->strUrlThumnail) . ',
							' . $objDatabase->SqlVariable($this->strKeyword1) . ',
							' . $objDatabase->SqlVariable($this->strKeyword2) . ',
							' . $objDatabase->SqlVariable($this->strKeyword3) . ',
							' . $objDatabase->SqlVariable($this->strKeyword4) . ',
							' . $objDatabase->SqlVariable($this->strKeyword5) . ',
							' . $objDatabase->SqlVariable($this->strKeyword6) . ',
							' . $objDatabase->SqlVariable($this->strKeyword7) . ',
							' . $objDatabase->SqlVariable($this->strKeyword8) . ',
							' . $objDatabase->SqlVariable($this->strKeyword9) . ',
							' . $objDatabase->SqlVariable($this->strKeyword10) . ',
							' . $objDatabase->SqlVariable($this->dttRegisterDate) . ',
							' . $objDatabase->SqlVariable($this->intStatus) . ',
							' . $objDatabase->SqlVariable($this->strActive) . '
						)
					');

					// Update Identity column and return its value
					$mixToReturn = $this->intId = $objDatabase->InsertId('table_portfolio', 'id');
				} else {
					// Perform an UPDATE query

					// First checking for Optimistic Locking constraints (if applicable)

					// Perform the UPDATE query
					$objDatabase->NonQuery('
						UPDATE
							`table_portfolio`
						SET
							`user_id` = ' . $objDatabase->SqlVariable($this->intUserId) . ',
							`booth_id` = ' . $objDatabase->SqlVariable($this->intBoothId) . ',
							`category_id` = ' . $objDatabase->SqlVariable($this->intCategoryId) . ',
							`subcategory_id` = ' . $objDatabase->SqlVariable($this->intSubcategoryId) . ',
							`colors_id` = ' . $objDatabase->SqlVariable($this->intColorsId) . ',
							`feels_id` = ' . $objDatabase->SqlVariable($this->intFeelsId) . ',
							`portfolio_category_id` = ' . $objDatabase->SqlVariable($this->intPortfolioCategoryId) . ',
							`title` = ' . $objDatabase->SqlVariable($this->strTitle) . ',
							`portfolio_image` = ' . $objDatabase->SqlVariable($this->strPortfolioImage) . ',
							`portfolio_thumnail` = ' . $objDatabase->SqlVariable($this->strPortfolioThumnail) . ',
							`filename` = ' . $objDatabase->SqlVariable($this->strFilename) . ',
							`filename_thumnail` = ' . $objDatabase->SqlVariable($this->strFilenameThumnail) . ',
							`url` = ' . $objDatabase->SqlVariable($this->strUrl) . ',
							`url_thumnail` = ' . $objDatabase->SqlVariable($this->strUrlThumnail) . ',
							`keyword1` = ' . $objDatabase->SqlVariable($this->strKeyword1) . ',
							`keyword2` = ' . $objDatabase->SqlVariable($this->strKeyword2) . ',
							`keyword3` = ' . $objDatabase->SqlVariable($this->strKeyword3) . ',
							`keyword4` = ' . $objDatabase->SqlVariable($this->strKeyword4) . ',
							`keyword5` = ' . $objDatabase->SqlVariable($this->strKeyword5) . ',
							`keyword6` = ' . $objDatabase->SqlVariable($this->strKeyword6) . ',
							`keyword7` = ' . $objDatabase->SqlVariable($this->strKeyword7) . ',
							`keyword8` = ' . $objDatabase->SqlVariable($this->strKeyword8) . ',
							`keyword9` = ' . $objDatabase->SqlVariable($this->strKeyword9) . ',
							`keyword10` = ' . $objDatabase->SqlVariable($this->strKeyword10) . ',
							`register_date` = ' . $objDatabase->SqlVariable($this->dttRegisterDate) . ',
							`status` = ' . $objDatabase->SqlVariable($this->intStatus) . ',
							`active` = ' . $objDatabase->SqlVariable($this->strActive) . '
						WHERE
							`id` = ' . $objDatabase->SqlVariable($this->intId) . '
					');
				}

			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}

			// Update __blnRestored and any Non-Identity PK Columns (if applicable)
			$this->__blnRestored = true;


			// Return 
			return $mixToReturn;
		}

		/**
		 * Delete this TablePortfolio
		 * @return void
		 */
		public function Delete() {
			if ((is_null($this->intId)))
				throw new QUndefinedPrimaryKeyException('Cannot delete this TablePortfolio with an unset primary key.');

			// Get the Database Object for this Class
			$objDatabase = TablePortfolio::GetDatabase();


			// Perform the SQL Query
			$objDatabase->NonQuery('
				DELETE FROM
					`table_portfolio`
				WHERE
					`id` = ' . $objDatabase->SqlVariable($this->intId) . '');
		}

		/**
		 * Delete all TablePortfolios
		 * @return void
		 */
		public static function DeleteAll() {
			// Get the Database Object for this Class
			$objDatabase = TablePortfolio::GetDatabase();

			// Perform the Query
			$objDatabase->NonQuery('
				DELETE FROM
					`table_portfolio`');
		}

		/**
		 * Truncate table_portfolio table
		 * @return void
		 */
		public static function Truncate() {
			// Get the Database Object for this Class
			$objDatabase = TablePortfolio::GetDatabase();

			// Perform the Query
			$objDatabase->NonQuery('
				TRUNCATE `table_portfolio`');
		}

		/**
		 * Reload this TablePortfolio from the database.
		 * @return void
		 */
		public function Reload() {
			// Make sure we are actually Restored from the database
			if (!$this->__blnRestored)
				throw new QCallerException('Cannot call Reload() on a new, unsaved TablePortfolio object.');

			// Reload the Object
			$objReloaded = TablePortfolio::Load($this->intId);

			// Update $this's local variables to match
			$this->UserId = $objReloaded->UserId;
			$this->intBoothId = $objReloaded->intBoothId;
			$this->intCategoryId = $objReloaded->intCategoryId;
			$this->intSubcategoryId = $objReloaded->intSubcategoryId;
			$this->intColorsId = $objReloaded->intColorsId;
			$this->intFeelsId = $objReloaded->intFeelsId;
			$this->intPortfolioCategoryId = $objReloaded->intPortfolioCategoryId;
			$this->strTitle = $objReloaded->strTitle;
			$this->strPortfolioImage = $objReloaded->strPortfolioImage;
			$this->strPortfolioThumnail = $objReloaded->strPortfolioThumnail;
			$this->strFilename = $objReloaded->strFilename;
			$this->strFilenameThumnail = $objReloaded->strFilenameThumnail;
			$this->strUrl = $objReloaded->strUrl;
			$this->strUrlThumnail = $objReloaded->strUrlThumnail;
			$this->strKeyword1 = $objReloaded->strKeyword1;
			$this->strKeyword2 = $objReloaded->strKeyword2;
			$this->strKeyword3 = $objReloaded->strKeyword3;
			$this->strKeyword4 = $objReloaded->strKeyword4;
			$this->strKeyword5 = $objReloaded->strKeyword5;
			$this->strKeyword6 = $objReloaded->strKeyword6;
			$this->strKeyword7 = $objReloaded->strKeyword7;
			$this->strKeyword8 = $objReloaded->strKeyword8;
			$this->strKeyword9 = $objReloaded->strKeyword9;
			$this->strKeyword10 = $objReloaded->strKeyword10;
			$this->dttRegisterDate = $objReloaded->dttRegisterDate;
			$this->intStatus = $objReloaded->intStatus;
			$this->strActive = $objReloaded->strActive;
		}



		////////////////////
		// PUBLIC OVERRIDERS
		////////////////////

				/**
		 * Override method to perform a property "Get"
		 * This will get the value of $strName
		 *
		 * @param string $strName Name of the property to get
		 * @return mixed
		 */
		public function __get($strName) {
			switch ($strName) {
				///////////////////
				// Member Variables
				///////////////////
				case 'Id':
					/**
					 * Gets the value for intId (Read-Only PK)
					 * @return integer
					 */
					return $this->intId;

				case 'UserId':
					/**
					 * Gets the value for intUserId (Not Null)
					 * @return integer
					 */
					return $this->intUserId;

				case 'BoothId':
					/**
					 * Gets the value for intBoothId (Not Null)
					 * @return integer
					 */
					return $this->intBoothId;

				case 'CategoryId':
					/**
					 * Gets the value for intCategoryId 
					 * @return integer
					 */
					return $this->intCategoryId;

				case 'SubcategoryId':
					/**
					 * Gets the value for intSubcategoryId 
					 * @return integer
					 */
					return $this->intSubcategoryId;

				case 'ColorsId':
					/**
					 * Gets the value for intColorsId 
					 * @return integer
					 */
					return $this->intColorsId;

				case 'FeelsId':
					/**
					 * Gets the value for intFeelsId 
					 * @return integer
					 */
					return $this->intFeelsId;

				case 'PortfolioCategoryId':
					/**
					 * Gets the value for intPortfolioCategoryId 
					 * @return integer
					 */
					return $this->intPortfolioCategoryId;

				case 'Title':
					/**
					 * Gets the value for strTitle (Not Null)
					 * @return string
					 */
					return $this->strTitle;

				case 'PortfolioImage':
					/**
					 * Gets the value for strPortfolioImage 
					 * @return string
					 */
					return $this->strPortfolioImage;

				case 'PortfolioThumnail':
					/**
					 * Gets the value for strPortfolioThumnail 
					 * @return string
					 */
					return $this->strPortfolioThumnail;

				case 'Filename':
					/**
					 * Gets the value for strFilename 
					 * @return string
					 */
					return $this->strFilename;

				case 'FilenameThumnail':
					/**
					 * Gets the value for strFilenameThumnail 
					 * @return string
					 */
					return $this->strFilenameThumnail;

				case 'Url':
					/**
					 * Gets the value for strUrl 
					 * @return string
					 */
					return $this->strUrl;

				case 'UrlThumnail':
					/**
					 * Gets the value for strUrlThumnail 
					 * @return string
					 */
					return $this->strUrlThumnail;

				case 'Keyword1':
					/**
					 * Gets the value for strKeyword1 
					 * @return string
					 */
					return $this->strKeyword1;

				case 'Keyword2':
					/**
					 * Gets the value for strKeyword2 
					 * @return string
					 */
					return $this->strKeyword2;

				case 'Keyword3':
					/**
					 * Gets the value for strKeyword3 
					 * @return string
					 */
					return $this->strKeyword3;

				case 'Keyword4':
					/**
					 * Gets the value for strKeyword4 
					 * @return string
					 */
					return $this->strKeyword4;

				case 'Keyword5':
					/**
					 * Gets the value for strKeyword5 
					 * @return string
					 */
					return $this->strKeyword5;

				case 'Keyword6':
					/**
					 * Gets the value for strKeyword6 
					 * @return string
					 */
					return $this->strKeyword6;

				case 'Keyword7':
					/**
					 * Gets the value for strKeyword7 
					 * @return string
					 */
					return $this->strKeyword7;

				case 'Keyword8':
					/**
					 * Gets the value for strKeyword8 
					 * @return string
					 */
					return $this->strKeyword8;

				case 'Keyword9':
					/**
					 * Gets the value for strKeyword9 
					 * @return string
					 */
					return $this->strKeyword9;

				case 'Keyword10':
					/**
					 * Gets the value for strKeyword10 
					 * @return string
					 */
					return $this->strKeyword10;

				case 'RegisterDate':
					/**
					 * Gets the value for dttRegisterDate 
					 * @return QDateTime
					 */
					return $this->dttRegisterDate;

				case 'Status':
					/**
					 * Gets the value for intStatus (Not Null)
					 * @return integer
					 */
					return $this->intStatus;

				case 'Active':
					/**
					 * Gets the value for strActive (Not Null)
					 * @return string
					 */
					return $this->strActive;


				///////////////////
				// Member Objects
				///////////////////
				case 'User':
					/**
					 * Gets the value for the TableUserProject object referenced by intUserId (Not Null)
					 * @return TableUserProject
					 */
					try {
						if ((!$this->objUser) && (!is_null($this->intUserId)))
							$this->objUser = TableUserProject::Load($this->intUserId);
						return $this->objUser;
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}


				////////////////////////////
				// Virtual Object References (Many to Many and Reverse References)
				// (If restored via a "Many-to" expansion)
				////////////////////////////


				case '__Restored':
					return $this->__blnRestored;

				default:
					try {
						return parent::__get($strName);
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}
			}
		}

				/**
		 * Override method to perform a property "Set"
		 * This will set the property $strName to be $mixValue
		 *
		 * @param string $strName Name of the property to set
		 * @param string $mixValue New value of the property
		 * @return mixed
		 */
		public function __set($strName, $mixValue) {
			switch ($strName) {
				///////////////////
				// Member Variables
				///////////////////
				case 'UserId':
					/**
					 * Sets the value for intUserId (Not Null)
					 * @param integer $mixValue
					 * @return integer
					 */
					try {
						$this->objUser = null;
						return ($this->intUserId = QType::Cast($mixValue, QType::Integer));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'BoothId':
					/**
					 * Sets the value for intBoothId (Not Null)
					 * @param integer $mixValue
					 * @return integer
					 */
					try {
						return ($this->intBoothId = QType::Cast($mixValue, QType::Integer));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'CategoryId':
					/**
					 * Sets the value for intCategoryId 
					 * @param integer $mixValue
					 * @return integer
					 */
					try {
						return ($this->intCategoryId = QType::Cast($mixValue, QType::Integer));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'SubcategoryId':
					/**
					 * Sets the value for intSubcategoryId 
					 * @param integer $mixValue
					 * @return integer
					 */
					try {
						return ($this->intSubcategoryId = QType::Cast($mixValue, QType::Integer));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'ColorsId':
					/**
					 * Sets the value for intColorsId 
					 * @param integer $mixValue
					 * @return integer
					 */
					try {
						return ($this->intColorsId = QType::Cast($mixValue, QType::Integer));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'FeelsId':
					/**
					 * Sets the value for intFeelsId 
					 * @param integer $mixValue
					 * @return integer
					 */
					try {
						return ($this->intFeelsId = QType::Cast($mixValue, QType::Integer));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'PortfolioCategoryId':
					/**
					 * Sets the value for intPortfolioCategoryId 
					 * @param integer $mixValue
					 * @return integer
					 */
					try {
						return ($this->intPortfolioCategoryId = QType::Cast($mixValue, QType::Integer));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'Title':
					/**
					 * Sets the value for strTitle (Not Null)
					 * @param string $mixValue
					 * @return string
					 */
					try {
						return ($this->strTitle = QType::Cast($mixValue, QType::String));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'PortfolioImage':
					/**
					 * Sets the value for strPortfolioImage 
					 * @param string $mixValue
					 * @return string
					 */
					try {
						return ($this->strPortfolioImage = QType::Cast($mixValue, QType::String));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'PortfolioThumnail':
					/**
					 * Sets the value for strPortfolioThumnail 
					 * @param string $mixValue
					 * @return string
					 */
					try {
						return ($this->strPortfolioThumnail = QType::Cast($mixValue, QType::String));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'Filename':
					/**
					 * Sets the value for strFilename 
					 * @param string $mixValue
					 * @return string
					 */
					try {
						return ($this->strFilename = QType::Cast($mixValue, QType::String));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'FilenameThumnail':
					/**
					 * Sets the value for strFilenameThumnail 
					 * @param string $mixValue
					 * @return string
					 */
					try {
						return ($this->strFilenameThumnail = QType::Cast($mixValue, QType::String));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'Url':
					/**
					 * Sets the value for strUrl 
					 * @param string $mixValue
					 * @return string
					 */
					try {
						return ($this->strUrl = QType::Cast($mixValue, QType::String));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'UrlThumnail':
					/**
					 * Sets the value for strUrlThumnail 
					 * @param string $mixValue
					 * @return string
					 */
					try {
						return ($this->strUrlThumnail = QType::Cast($mixValue, QType::String));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'Keyword1':
					/**
					 * Sets the value for strKeyword1 
					 * @param string $mixValue
					 * @return string
					 */
					try {
						return ($this->strKeyword1 = QType::Cast($mixValue, QType::String));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'Keyword2':
					/**
					 * Sets the value for strKeyword2 
					 * @param string $mixValue
					 * @return string
					 */
					try {
						return ($this->strKeyword2 = QType::Cast($mixValue, QType::String));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'Keyword3':
					/**
					 * Sets the value for strKeyword3 
					 * @param string $mixValue
					 * @return string
					 */
					try {
						return ($this->strKeyword3 = QType::Cast($mixValue, QType::String));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'Keyword4':
					/**
					 * Sets the value for strKeyword4 
					 * @param string $mixValue
					 * @return string
					 */
					try {
						return ($this->strKeyword4 = QType::Cast($mixValue, QType::String));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'Keyword5':
					/**
					 * Sets the value for strKeyword5 
					 * @param string $mixValue
					 * @return string
					 */
					try {
						return ($this->strKeyword5 = QType::Cast($mixValue, QType::String));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'Keyword6':
					/**
					 * Sets the value for strKeyword6 
					 * @param string $mixValue
					 * @return string
					 */
					try {
						return ($this->strKeyword6 = QType::Cast($mixValue, QType::String));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'Keyword7':
					/**
					 * Sets the value for strKeyword7 
					 * @param string $mixValue
					 * @return string
					 */
					try {
						return ($this->strKeyword7 = QType::Cast($mixValue, QType::String));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'Keyword8':
					/**
					 * Sets the value for strKeyword8 
					 * @param string $mixValue
					 * @return string
					 */
					try {
						return ($this->strKeyword8 = QType::Cast($mixValue, QType::String));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'Keyword9':
					/**
					 * Sets the value for strKeyword9 
					 * @param string $mixValue
					 * @return string
					 */
					try {
						return ($this->strKeyword9 = QType::Cast($mixValue, QType::String));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'Keyword10':
					/**
					 * Sets the value for strKeyword10 
					 * @param string $mixValue
					 * @return string
					 */
					try {
						return ($this->strKeyword10 = QType::Cast($mixValue, QType::String));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'RegisterDate':
					/**
					 * Sets the value for dttRegisterDate 
					 * @param QDateTime $mixValue
					 * @return QDateTime
					 */
					try {
						return ($this->dttRegisterDate = QType::Cast($mixValue, QType::DateTime));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'Status':
					/**
					 * Sets the value for intStatus (Not Null)
					 * @param integer $mixValue
					 * @return integer
					 */
					try {
						return ($this->intStatus = QType::Cast($mixValue, QType::Integer));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'Active':
					/**
					 * Sets the value for strActive (Not Null)
					 * @param string $mixValue
					 * @return string
					 */
					try {
						return ($this->strActive = QType::Cast($mixValue, QType::String));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}


				///////////////////
				// Member Objects
				///////////////////
				case 'User':
					/**
					 * Sets the value for the TableUserProject object referenced by intUserId (Not Null)
					 * @param TableUserProject $mixValue
					 * @return TableUserProject
					 */
					if (is_null($mixValue)) {
						$this->intUserId = null;
						$this->objUser = null;
						return null;
					} else {
						// Make sure $mixValue actually is a TableUserProject object
						try {
							$mixValue = QType::Cast($mixValue, 'TableUserProject');
						} catch (QInvalidCastException $objExc) {
							$objExc->IncrementOffset();
							throw $objExc;
						} 

						// Make sure $mixValue is a SAVED TableUserProject object
						if (is_null($mixValue->Id))
							throw new QCallerException('Unable to set an unsaved User for this TablePortfolio');

						// Update Local Member Variables
						$this->objUser = $mixValue;
						$this->intUserId = $mixValue->Id;

						// Return $mixValue
						return $mixValue;
					}
					break;

				default:
					try {
						return parent::__set($strName, $mixValue);
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}
			}
		}

		/**
		 * Lookup a VirtualAttribute value (if applicable).  Returns NULL if none found.
		 * @param string $strName
		 * @return string
		 */
		public function GetVirtualAttribute($strName) {
			if (array_key_exists($strName, $this->__strVirtualAttributeArray))
				return $this->__strVirtualAttributeArray[$strName];
			return null;
		}



		///////////////////////////////
		// ASSOCIATED OBJECTS' METHODS
		///////////////////////////////





		////////////////////////////////////////
		// METHODS for SOAP-BASED WEB SERVICES
		////////////////////////////////////////

		public static function GetSoapComplexTypeXml() {
			$strToReturn = '<complexType name="TablePortfolio"><sequence>';
			$strToReturn .= '<element name="Id" type="xsd:int"/>';
			$strToReturn .= '<element name="User" type="xsd1:TableUserProject"/>';
			$strToReturn .= '<element name="BoothId" type="xsd:int"/>';
			$strToReturn .= '<element name="CategoryId" type="xsd:int"/>';
			$strToReturn .= '<element name="SubcategoryId" type="xsd:int"/>';
			$strToReturn .= '<element name="ColorsId" type="xsd:int"/>';
			$strToReturn .= '<element name="FeelsId" type="xsd:int"/>';
			$strToReturn .= '<element name="PortfolioCategoryId" type="xsd:int"/>';
			$strToReturn .= '<element name="Title" type="xsd:string"/>';
			$strToReturn .= '<element name="PortfolioImage" type="xsd:string"/>';
			$strToReturn .= '<element name="PortfolioThumnail" type="xsd:string"/>';
			$strToReturn .= '<element name="Filename" type="xsd:string"/>';
			$strToReturn .= '<element name="FilenameThumnail" type="xsd:string"/>';
			$strToReturn .= '<element name="Url" type="xsd:string"/>';
			$strToReturn .= '<element name="UrlThumnail" type="xsd:string"/>';
			$strToReturn .= '<element name="Keyword1" type="xsd:string"/>';
			$strToReturn .= '<element name="Keyword2" type="xsd:string"/>';
			$strToReturn .= '<element name="Keyword3" type="xsd:string"/>';
			$strToReturn .= '<element name="Keyword4" type="xsd:string"/>';
			$strToReturn .= '<element name="Keyword5" type="xsd:string"/>';
			$strToReturn .= '<element name="Keyword6" type="xsd:string"/>';
			$strToReturn .= '<element name="Keyword7" type="xsd:string"/>';
			$strToReturn .= '<element name="Keyword8" type="xsd:string"/>';
			$strToReturn .= '<element name="Keyword9" type="xsd:string"/>';
			$strToReturn .= '<element name="Keyword10" type="xsd:string"/>';
			$strToReturn .= '<element name="RegisterDate" type="xsd:dateTime"/>';
			$strToReturn .= '<element name="Status" type="xsd:int"/>';
			$strToReturn .= '<element name="Active" type="xsd:string"/>';
			$strToReturn .= '<element name="__blnRestored" type="xsd:boolean"/>';
			$strToReturn .= '</sequence></complexType>';
			return $strToReturn;
		}

		public static function AlterSoapComplexTypeArray(&$strComplexTypeArray) {
			if (!array_key_exists('TablePortfolio', $strComplexTypeArray)) {
				$strComplexTypeArray['TablePortfolio'] = TablePortfolio::GetSoapComplexTypeXml();
				TableUserProject::AlterSoapComplexTypeArray($strComplexTypeArray);
			}
		}

		public static function GetArrayFromSoapArray($objSoapArray) {
			$objArrayToReturn = array();

			foreach ($objSoapArray as $objSoapObject)
				array_push($objArrayToReturn, TablePortfolio::GetObjectFromSoapObject($objSoapObject));

			return $objArrayToReturn;
		}

		public static function GetObjectFromSoapObject($objSoapObject) {
			$objToReturn = new TablePortfolio();
			if (property_exists($objSoapObject, 'Id'))
				$objToReturn->intId = $objSoapObject->Id;
			if ((property_exists($objSoapObject, 'User')) &&
				($objSoapObject->User))
				$objToReturn->User = TableUserProject::GetObjectFromSoapObject($objSoapObject->User);
			if (property_exists($objSoapObject, 'BoothId'))
				$objToReturn->intBoothId = $objSoapObject->BoothId;
			if (property_exists($objSoapObject, 'CategoryId'))
				$objToReturn->intCategoryId = $objSoapObject->CategoryId;
			if (property_exists($objSoapObject, 'SubcategoryId'))
				$objToReturn->intSubcategoryId = $objSoapObject->SubcategoryId;
			if (property_exists($objSoapObject, 'ColorsId'))
				$objToReturn->intColorsId = $objSoapObject->ColorsId;
			if (property_exists($objSoapObject, 'FeelsId'))
				$objToReturn->intFeelsId = $objSoapObject->FeelsId;
			if (property_exists($objSoapObject, 'PortfolioCategoryId'))
				$objToReturn->intPortfolioCategoryId = $objSoapObject->PortfolioCategoryId;
			if (property_exists($objSoapObject, 'Title'))
				$objToReturn->strTitle = $objSoapObject->Title;
			if (property_exists($objSoapObject, 'PortfolioImage'))
				$objToReturn->strPortfolioImage = $objSoapObject->PortfolioImage;
			if (property_exists($objSoapObject, 'PortfolioThumnail'))
				$objToReturn->strPortfolioThumnail = $objSoapObject->PortfolioThumnail;
			if (property_exists($objSoapObject, 'Filename'))
				$objToReturn->strFilename = $objSoapObject->Filename;
			if (property_exists($objSoapObject, 'FilenameThumnail'))
				$objToReturn->strFilenameThumnail = $objSoapObject->FilenameThumnail;
			if (property_exists($objSoapObject, 'Url'))
				$objToReturn->strUrl = $objSoapObject->Url;
			if (property_exists($objSoapObject, 'UrlThumnail'))
				$objToReturn->strUrlThumnail = $objSoapObject->UrlThumnail;
			if (property_exists($objSoapObject, 'Keyword1'))
				$objToReturn->strKeyword1 = $objSoapObject->Keyword1;
			if (property_exists($objSoapObject, 'Keyword2'))
				$objToReturn->strKeyword2 = $objSoapObject->Keyword2;
			if (property_exists($objSoapObject, 'Keyword3'))
				$objToReturn->strKeyword3 = $objSoapObject->Keyword3;
			if (property_exists($objSoapObject, 'Keyword4'))
				$objToReturn->strKeyword4 = $objSoapObject->Keyword4;
			if (property_exists($objSoapObject, 'Keyword5'))
				$objToReturn->strKeyword5 = $objSoapObject->Keyword5;
			if (property_exists($objSoapObject, 'Keyword6'))
				$objToReturn->strKeyword6 = $objSoapObject->Keyword6;
			if (property_exists($objSoapObject, 'Keyword7'))
				$objToReturn->strKeyword7 = $objSoapObject->Keyword7;
			if (property_exists($objSoapObject, 'Keyword8'))
				$objToReturn->strKeyword8 = $objSoapObject->Keyword8;
			if (property_exists($objSoapObject, 'Keyword9'))
				$objToReturn->strKeyword9 = $objSoapObject->Keyword9;
			if (property_exists($objSoapObject, 'Keyword10'))
				$objToReturn->strKeyword10 = $objSoapObject->Keyword10;
			if (property_exists($objSoapObject, 'RegisterDate'))
				$objToReturn->dttRegisterDate = new QDateTime($objSoapObject->RegisterDate);
			if (property_exists($objSoapObject, 'Status'))
				$objToReturn->intStatus = $objSoapObject->Status;
			if (property_exists($objSoapObject, 'Active'))
				$objToReturn->strActive = $objSoapObject->Active;
			if (property_exists($objSoapObject, '__blnRestored'))
				$objToReturn->__blnRestored = $objSoapObject->__blnRestored;
			return $objToReturn;
		}

		public static function GetSoapArrayFromArray($objArray) {
			if (!$objArray)
				return null;

			$objArrayToReturn = array();

			foreach ($objArray as $objObject)
				array_push($objArrayToReturn, TablePortfolio::GetSoapObjectFromObject($objObject, true));

			return unserialize(serialize($objArrayToReturn));
		}

		public static function GetSoapObjectFromObject($objObject, $blnBindRelatedObjects) {
			if ($objObject->objUser)
				$objObject->objUser = TableUserProject::GetSoapObjectFromObject($objObject->objUser, false);
			else if (!$blnBindRelatedObjects)
				$objObject->intUserId = null;
			if ($objObject->dttRegisterDate)
				$objObject->dttRegisterDate = $objObject->dttRegisterDate->__toString(QDateTime::FormatSoap);
			return $objObject;
		}




	}



	/////////////////////////////////////
	// ADDITIONAL CLASSES for QCubed QUERY
	/////////////////////////////////////

	class QQNodeTablePortfolio extends QQNode {
		protected $strTableName = 'table_portfolio';
		protected $strPrimaryKey = 'id';
		protected $strClassName = 'TablePortfolio';
		public function __get($strName) {
			switch ($strName) {
				case 'Id':
					return new QQNode('id', 'Id', 'integer', $this);
				case 'UserId':
					return new QQNode('user_id', 'UserId', 'integer', $this);
				case 'User':
					return new QQNodeTableUserProject('user_id', 'User', 'integer', $this);
				case 'BoothId':
					return new QQNode('booth_id', 'BoothId', 'integer', $this);
				case 'CategoryId':
					return new QQNode('category_id', 'CategoryId', 'integer', $this);
				case 'SubcategoryId':
					return new QQNode('subcategory_id', 'SubcategoryId', 'integer', $this);
				case 'ColorsId':
					return new QQNode('colors_id', 'ColorsId', 'integer', $this);
				case 'FeelsId':
					return new QQNode('feels_id', 'FeelsId', 'integer', $this);
				case 'PortfolioCategoryId':
					return new QQNode('portfolio_category_id', 'PortfolioCategoryId', 'integer', $this);
				case 'Title':
					return new QQNode('title', 'Title', 'string', $this);
				case 'PortfolioImage':
					return new QQNode('portfolio_image', 'PortfolioImage', 'string', $this);
				case 'PortfolioThumnail':
					return new QQNode('portfolio_thumnail', 'PortfolioThumnail', 'string', $this);
				case 'Filename':
					return new QQNode('filename', 'Filename', 'string', $this);
				case 'FilenameThumnail':
					return new QQNode('filename_thumnail', 'FilenameThumnail', 'string', $this);
				case 'Url':
					return new QQNode('url', 'Url', 'string', $this);
				case 'UrlThumnail':
					return new QQNode('url_thumnail', 'UrlThumnail', 'string', $this);
				case 'Keyword1':
					return new QQNode('keyword1', 'Keyword1', 'string', $this);
				case 'Keyword2':
					return new QQNode('keyword2', 'Keyword2', 'string', $this);
				case 'Keyword3':
					return new QQNode('keyword3', 'Keyword3', 'string', $this);
				case 'Keyword4':
					return new QQNode('keyword4', 'Keyword4', 'string', $this);
				case 'Keyword5':
					return new QQNode('keyword5', 'Keyword5', 'string', $this);
				case 'Keyword6':
					return new QQNode('keyword6', 'Keyword6', 'string', $this);
				case 'Keyword7':
					return new QQNode('keyword7', 'Keyword7', 'string', $this);
				case 'Keyword8':
					return new QQNode('keyword8', 'Keyword8', 'string', $this);
				case 'Keyword9':
					return new QQNode('keyword9', 'Keyword9', 'string', $this);
				case 'Keyword10':
					return new QQNode('keyword10', 'Keyword10', 'string', $this);
				case 'RegisterDate':
					return new QQNode('register_date', 'RegisterDate', 'QDateTime', $this);
				case 'Status':
					return new QQNode('status', 'Status', 'integer', $this);
				case 'Active':
					return new QQNode('active', 'Active', 'string', $this);

				case '_PrimaryKeyNode':
					return new QQNode('id', 'Id', 'integer', $this);
				default:
					try {
						return parent::__get($strName);
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}
			}
		}
	}

	class QQReverseReferenceNodeTablePortfolio extends QQReverseReferenceNode {
		protected $strTableName = 'table_portfolio';
		protected $strPrimaryKey = 'id';
		protected $strClassName = 'TablePortfolio';
		public function __get($strName) {
			switch ($strName) {
				case 'Id':
					return new QQNode('id', 'Id', 'integer', $this);
				case 'UserId':
					return new QQNode('user_id', 'UserId', 'integer', $this);
				case 'User':
					return new QQNodeTableUserProject('user_id', 'User', 'integer', $this);
				case 'BoothId':
					return new QQNode('booth_id', 'BoothId', 'integer', $this);
				case 'CategoryId':
					return new QQNode('category_id', 'CategoryId', 'integer', $this);
				case 'SubcategoryId':
					return new QQNode('subcategory_id', 'SubcategoryId', 'integer', $this);
				case 'ColorsId':
					return new QQNode('colors_id', 'ColorsId', 'integer', $this);
				case 'FeelsId':
					return new QQNode('feels_id', 'FeelsId', 'integer', $this);
				case 'PortfolioCategoryId':
					return new QQNode('portfolio_category_id', 'PortfolioCategoryId', 'integer', $this);
				case 'Title':
					return new QQNode('title', 'Title', 'string', $this);
				case 'PortfolioImage':
					return new QQNode('portfolio_image', 'PortfolioImage', 'string', $this);
				case 'PortfolioThumnail':
					return new QQNode('portfolio_thumnail', 'PortfolioThumnail', 'string', $this);
				case 'Filename':
					return new QQNode('filename', 'Filename', 'string', $this);
				case 'FilenameThumnail':
					return new QQNode('filename_thumnail', 'FilenameThumnail', 'string', $this);
				case 'Url':
					return new QQNode('url', 'Url', 'string', $this);
				case 'UrlThumnail':
					return new QQNode('url_thumnail', 'UrlThumnail', 'string', $this);
				case 'Keyword1':
					return new QQNode('keyword1', 'Keyword1', 'string', $this);
				case 'Keyword2':
					return new QQNode('keyword2', 'Keyword2', 'string', $this);
				case 'Keyword3':
					return new QQNode('keyword3', 'Keyword3', 'string', $this);
				case 'Keyword4':
					return new QQNode('keyword4', 'Keyword4', 'string', $this);
				case 'Keyword5':
					return new QQNode('keyword5', 'Keyword5', 'string', $this);
				case 'Keyword6':
					return new QQNode('keyword6', 'Keyword6', 'string', $this);
				case 'Keyword7':
					return new QQNode('keyword7', 'Keyword7', 'string', $this);
				case 'Keyword8':
					return new QQNode('keyword8', 'Keyword8', 'string', $this);
				case 'Keyword9':
					return new QQNode('keyword9', 'Keyword9', 'string', $this);
				case 'Keyword10':
					return new QQNode('keyword10', 'Keyword10', 'string', $this);
				case 'RegisterDate':
					return new QQNode('register_date', 'RegisterDate', 'QDateTime', $this);
				case 'Status':
					return new QQNode('status', 'Status', 'integer', $this);
				case 'Active':
					return new QQNode('active', 'Active', 'string', $this);

				case '_PrimaryKeyNode':
					return new QQNode('id', 'Id', 'integer', $this);
				default:
					try {
						return parent::__get($strName);
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}
			}
		}
	}

?>